package com.netease.financial.ui.fragment;

import cn.bingoogolapple.badgeview.BGABadgeable;

/**
 * Created by wyf on 8/3/15.
 */
public abstract class TabFragment extends BaseFragment {

    private static final String TAG = TabFragment.class.getSimpleName();

    private BGABadgeable mTabBadgeView;

    public abstract boolean isTabBadgeShouldShow();

    public abstract void showBadge(BGABadgeable badgeView);

    public void setTabBadgeView(BGABadgeable badgeView) {
        mTabBadgeView = badgeView;
        refreshTabBadgeView();
    }

    public void refreshTabBadgeView() {
        if (mTabBadgeView == null) {
            return;
        }
        if (isTabBadgeShouldShow()) {
            performShowBadge(mTabBadgeView);
        } else {
            mTabBadgeView.hiddenBadge();
        }
    }

    private void performShowBadge(BGABadgeable badgeView) {
        showBadge(badgeView);
    }
}
